<template>
	<view class="content">
		<view class="item" @longtap="delLike(1,index)" v-for="(item,index) of actitity" :key="item.id">
			<activity3></activity3>
		</view>
	</view>
</template>

<script>
	import Activity3 from '../../components/activity3.vue'
	export default {
		name: 'Like',
		data: function () {
			return {
				actitity: [{
					id: 1,
					name: 'xxxx'
				}, {
					id: 1,
					name: 'xxxx'
				}, {
					id: 1,
					name: 'xxxx'
				}, {
					id: 1,
					name: 'xxxx'
				}],
				id: null,
				index: null
			};
		},
		methods: {
			delLike(id, index) {
				// id 发送请求 ==》 根据ID删除收藏
				// 数组编号删除 
				let _this = this
				uni.showActionSheet({
					itemList: ['删除'],
					success: function (res) {
						if(res.tapIndex==0) { // 选择了第一个
							_this.actitity.splice(index,1);
						}
					},
					fail: function (res) {
						console.log(res.errMsg);
					}
				});
			}
		},
		components: {
			Activity3
		},
	}
</script>

<style scoped>
	page {
		background: #fff;
	}

	.item {
		padding-bottom: 20px;
		background: #EEEEEE;
	}
</style>
